package com.arithmetic.version1;

import static org.junit.Assert.*;
import org.junit.Test;

public class ExerciseTester {

    @Test
    public void testConstructor() {
        Exercise exercise = new Exercise();
        assertNotNull(exercise);
        assertEquals(0, exercise.size());
    }

    @Test
    public void testContains() {
        Exercise exercise = new Exercise();
        BinaryOperation op1 = new BinaryOperation(5, 3, '+');
        BinaryOperation op2 = new BinaryOperation(5, 3, '+');

        exercise.generateAdditionExercise(1); // 添加一个操作
        // 测试contains方法需要根据具体实现调整
    }

    @Test
    public void testGenerateAdditionExercise() {
        Exercise exercise = new Exercise();
        exercise.generateAdditionExercise(10);
        assertEquals(10, exercise.size());

        for (int i = 0; i < exercise.size(); i++) {
            assertEquals('+', exercise.getOperation(i).getOperator());
        }
    }

    @Test
    public void testGenerateSubstractExercise() {
        Exercise exercise = new Exercise();
        exercise.generateSubstractExercise(10);
        assertEquals(10, exercise.size());

        for (int i = 0; i < exercise.size(); i++) {
            assertEquals('-', exercise.getOperation(i).getOperator());
        }
    }
}
